//
//  GLGWButton.m
//  GLGW_Shoping
//
//  Created by yang on 2018/11/8.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "GLGWButton.h"

@implementation GLGWButton

-(void)setTitle:(NSString *)title{
    _title = title;
    [self setTitle:title forState:UIControlStateNormal];
}

-(void)setImage_Name:(NSString *)image_Name{
    [self setImage:[UIImage imageNamed:image_Name] forState:UIControlStateNormal];
}
//-------------------------------------------
-(id)initInSuperView:(UIView *)aSuperView{
    if (self = [super init]) {
        [aSuperView addSubview:self];
    }
    return self;
}

-(id)initWithFrame:(CGRect)aFrame inSuperView:(UIView *)aSuperView{
    if (self = [self initInSuperView:aSuperView]) {
        self.frame = aFrame;
    }
    return self;
}

-(id)initWithTitleLableFontType:(UIFont *)aFont titleColor:(UIColor *)aColor inSuperView:(UIView *)aSuperView{
    if (self = [self initInSuperView:aSuperView]) {
        self.titleLabel.font = aFont;
        [self setTitleColor:aColor forState:UIControlStateNormal];
    }
    return self;
}

-(id)initWithFrame:(CGRect)aFrame titleLableFont:(UIFont *)aFont titleColor:(UIColor *)aColor inSuperView:(UIView *)aSuperView{
    if (self = [self initWithTitleLableFontType:aFont titleColor:aColor inSuperView:aSuperView]) {
        self.frame = aFrame;
    }
    return self;
}

-(id)initWithTitle:(NSString *)aTitle titleLableFont:(UIFont *)aFont titleLableColor:(UIColor *)aColor inSuperView:(UIView *)aSuperView{
    if (self = [self initWithTitleLableFontType:aFont titleColor:aColor inSuperView:aSuperView]) {
        [self setTitle:aTitle forState:UIControlStateNormal];
    }
    return self;
}

-(id)initWithFrame:(CGRect)aFrame titleText:(NSString *)aTitle titleLableFont:(UIFont *)aFont titleLableColor:(UIColor *)aColor inSuperView:(UIView *)aSuperView{
    if (self = [self initWithTitle:aTitle titleLableFont:aFont titleLableColor:aColor inSuperView:aSuperView]) {
        self.frame = aFrame;
    }
    return self;
}

-(id)initWithTitle:(NSString *)aTitle titleLableFont:(UIFont *)aFont titleLableColor:(UIColor *)aColor theCornerRadius:(CGFloat)aCornerRadius backgroundColr:(UIColor *)bColor inSuperView:(UIView *)aSuperView{
    if (self = [self initWithTitle:aTitle titleLableFont:aFont titleLableColor:aColor inSuperView:aSuperView]) {
        self.layer.cornerRadius = aCornerRadius;
        self.backgroundColor = bColor;
        self.layer.masksToBounds = YES;
    }
    return self;
}

-(id)initWithFrame:(CGRect)aFrame hTitle:(NSString *)aTitle titleLableFont:(UIFont *)aFont titleLableColor:(UIColor *)aColor theCornerRadius:(CGFloat)aCornerRadius backgroundColr:(UIColor *)bColor inSuperView:(UIView *)aSuperView{
    if (self = [self initWithTitle:aTitle titleLableFont:aFont titleLableColor:aColor theCornerRadius:aCornerRadius backgroundColr:bColor inSuperView:aSuperView]) {
        self.frame = aFrame;
    }
    return self;
}

-(id)initWithTitle:(NSString *)aTitle titleLableFont:(UIFont *)aFont titleLableColor:(UIColor *)aColor theCornerRadius:(CGFloat)aCornerRadius theBorderWidth:(CGFloat)aBorderWidth theBorderColor:(UIColor *)aBorderColor backgroundColr:(UIColor *)bColor inSuperView:(UIView *)aSuperView{
    if (self = [self initWithTitle:aTitle titleLableFont:aFont titleLableColor:aColor theCornerRadius:aCornerRadius backgroundColr:bColor inSuperView:aSuperView]) {
        self.layer.borderWidth = aBorderWidth;
        self.layer.borderColor = aBorderColor.CGColor;
    }
    return self;
}

-(id)initWithFrame:(CGRect)aFrame hTitle:(NSString *)aTitle titleLableFont:(UIFont *)aFont titleLableColor:(UIColor *)aColor theCornerRadius:(CGFloat)aCornerRadius theBorderWidth:(CGFloat)aBorderWidth theBorderColor:(UIColor *)aBorderColor backgroundColr:(UIColor *)bColor inSuperView:(UIView *)aSuperView{
    if (self = [self initWithTitle:aTitle titleLableFont:aFont titleLableColor:aColor theCornerRadius:aCornerRadius backgroundColr:bColor inSuperView:aSuperView]) {
        self.frame = aFrame;
        self.layer.borderWidth = aBorderWidth;
        self.layer.borderColor = aBorderColor.CGColor;
    }
    return self;
}

@end
